package longcaisuyun.longcai.com.yiliubabalongcaisuyun;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import longcaisuyun.longcai.com.mystatic.publicUrl;


public class ShangPin_3 extends Activity {

    TextView textView;
    String title;
    String id;
    WebView webView;
    Button imageButton, imageButton2, imageButton3, imageButton4, bt_shangpinzhifu;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_shang_pin_3);
        View view = getWindow().getDecorView();
        MyApplication.ScaleScreenHelper.loadView((ViewGroup) view);
        textView = (TextView) findViewById(R.id.textView5);
        title = getIntent().getStringExtra("title");
        id = getIntent().getStringExtra("id");
        textView.setText(title);
        LinearLayout fanhui_lin = (LinearLayout) findViewById(R.id.fanhui);
        fanhui_lin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        webView = (WebView) findViewById(R.id.webView);
        webView.loadUrl(publicUrl.headurljikou + "Api/Web/speciprice/goodid/" + id);
        imageButton = (Button) findViewById(R.id.imageButton);
        imageButton2 = (Button) findViewById(R.id.imageButton2);
        imageButton3 = (Button) findViewById(R.id.imageButton3);
        imageButton4 = (Button) findViewById(R.id.imageButton4);
        bt_shangpinzhifu = (Button) findViewById(R.id.bt_next);
        imageButton.setBackgroundColor(Color.parseColor("#6ac7e4"));
        imageButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                imageButton4.setTextColor(Color.parseColor("#9f9f9f"));
                imageButton.setBackgroundColor(Color.parseColor("#6ac7e4"));
                imageButton2.setBackgroundColor(Color.parseColor("#9f9f9f"));
                imageButton3.setBackgroundColor(Color.parseColor("#9f9f9f"));
                imageButton4.setBackgroundResource(R.mipmap.select_lastshangpin);
                webView.loadUrl(publicUrl.headurljikou + "Api/Web/speciprice/goodid/" + id);
            }
        });
        imageButton2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                imageButton4.setTextColor(Color.parseColor("#9f9f9f"));
                imageButton2.setBackgroundColor(Color.parseColor("#6ac7e4"));
                imageButton.setBackgroundColor(Color.parseColor("#9f9f9f"));
                imageButton3.setBackgroundColor(Color.parseColor("#9f9f9f"));
                imageButton4.setBackgroundResource(R.mipmap.select_lastshangpin);
                webView.loadUrl(publicUrl.headurljikou + "Api/Web/content/goodid/" + id);
            }
        });
        imageButton3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                imageButton4.setTextColor(Color.parseColor("#9f9f9f"));
                imageButton3.setBackgroundColor(Color.parseColor("#6ac7e4"));
                imageButton.setBackgroundColor(Color.parseColor("#9f9f9f"));
                imageButton2.setBackgroundColor(Color.parseColor("#9f9f9f"));
                imageButton4.setBackgroundResource(R.mipmap.select_lastshangpin);
                webView.loadUrl(publicUrl.headurljikou + "Api/Web/factryinfo/goodid/" + id);
            }
        });
        imageButton4.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                //  imageButton4.setBackground(R.mipmap.select_lastshangpin);
                imageButton4.setTextColor(Color.parseColor("#6ac7e4"));
                imageButton4.setBackgroundResource(R.mipmap.zhifu);
                imageButton3.setBackgroundColor(Color.parseColor("#9f9f9f"));
                imageButton.setBackgroundColor(Color.parseColor("#9f9f9f"));
                imageButton2.setBackgroundColor(Color.parseColor("#9f9f9f"));
                webView.loadUrl(publicUrl.headurljikou + "Api/Web/payinfo/goodid/" + id);
            }
        });
        bt_shangpinzhifu.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(ShangPin_3.this, ShangPinZhiFuActivity.class);
                intent.putExtra("title", title);
                intent.putExtra("id", id);
                startActivity(intent);
            }
        });
    }
}
